<?php

Yii::import('zii.widgets.CListView');

class DListview extends CListView {

    public $template = '{items}{pager}';
    public $cssFile  = false;
    public $pager    = array('class' => 'ext.front.listview.DLinkPager');
    public $myPageSize;
    public $ajaxUpdate = false;
    public $pagerCssClass = 'myPager';

    public function init() {
        //set pagesize
        $this->setDefaultVar();
        parent::init();
    }

    private function setDefaultVar() {
        //pagination
        if (empty($this->myPageSize))
            $this->myPageSize = Yii::app()->params['front_page_size'];
        $this->dataProvider->pagination->pageSize = $this->myPageSize;
    }

    public function renderEmptyText() {
        echo CHtml::openTag('div');
        echo '<p>' . Yii::t('msg', 'no_data') . '</p>';
        echo '<p>'
            . CHtml::link('Click vào đây để quay về trang trước.', 'javascript:history.back(-1)', array(
                'class' => 'link lnColor2'
            ))
            . '</p>';
        echo CHtml::closeTag('div');
    }

}